Skip to content

fix: cap VecOf pre-allocation to prevent OOM on malformed input#570

Merged
kvinwang merged 1 commit intomasterfrom
fix/vecof-unbounded-alloc
Mar 19, 2026
Merged

fix: cap VecOf pre-allocation to prevent OOM on malformed input#570
kvinwang merged 1 commit intomasterfrom
fix/vecof-unbounded-alloc

Conversation

@kvinwang
Copy link
Copy Markdown
Collaborator

Summary

  • Cap Vec::with_capacity in VecOf::decode to 1024 to prevent OOM when parsing malformed event logs with excessively large count values
  • No semantic change — the Vec grows naturally via push if the actual count exceeds 1024

Test plan

  • cargo check -p cc-eventlog passes

Ref #567

Add a const generic MAX_LEN (default 65536) to VecOf that rejects
decode attempts exceeding the limit. Also cap with_capacity to 1024
to avoid large pre-allocations from untrusted input.

Existing VecOf<I, T> usages are unchanged due to the default value.
@kvinwang kvinwang force-pushed the fix/vecof-unbounded-alloc branch from e66ab0b to ef774eb Compare March 18, 2026 08:56
@kvinwang kvinwang merged commit 7503f4f into master Mar 19, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant